package com.sc.service.impl;

import com.sc.mapper.RelationMapper;
import com.sc.pojo.Relation;
import com.sc.service.RelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 陈远坤
 */
@Service
@Transactional
public class RelationServiceImpl implements RelationService {
    @Autowired
    RelationMapper mapper;
    @Override
    public void acceptFr(Relation r) {
        mapper.insert(r);
    }

    @Override
    public void deleteFr(Integer user1id, Integer user2id) {
         mapper.deleteByTwoids(user1id,user2id);
         mapper.deleteByTwoids(user2id,user1id);
    }

    @Override
    public void laHeiFr(Integer user1id, Integer user2id) {
        mapper.laHeiFr(user1id,user2id);
        mapper.laHeiFr(user2id,user1id);
    }
}
